package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 反馈类型枚举
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum FeedbackTypeEnum {
    /**
     * 1-建议
     */
    PROPOSAL(1, "Suggestion", ""),
    /**
     * 2-账号注销
     */
    UNSUBSCRIBE(2, "Unsubscribe", ""),
    /**
     * 3-建议
     */
    DELETE_PERSONAL_DATA(3, "Delete all user data", "");

    private final Integer code;
    private final String name;
    private final String desc;

    public static FeedbackTypeEnum getNameByCode(Integer code) {
        return Arrays.stream(FeedbackTypeEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }

}
